<?php

/**
 * Research form base class.
 *
 * @method Research getObject() Returns the current form's model object
 *
 * @package    Redsea20
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseResearchForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                      => new sfWidgetFormInputHidden(),
      'title'                   => new sfWidgetFormTextarea(),
      'citation'                => new sfWidgetFormTextarea(),
      'abstract'                => new sfWidgetFormTextarea(),
      'entityid'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Entity'), 'add_empty' => false)),
      'remarks'                 => new sfWidgetFormTextarea(),
      'publicationdate'         => new sfWidgetFormDate(),
      'researchpaper'           => new sfWidgetFormTextarea(),
      'researchpaperfilename'   => new sfWidgetFormInputText(),
      'researchpaperfiletype'   => new sfWidgetFormInputText(),
      'researchpaperfilesize'   => new sfWidgetFormInputText(),
      'researchpaperurl'        => new sfWidgetFormTextarea(),
      'researchstatustyperefid' => new sfWidgetFormInputText(),
      'approvalstatustyperefid' => new sfWidgetFormInputText(),
      'approvalauthorityid'     => new sfWidgetFormInputText(),
      'createbyuserid'          => new sfWidgetFormInputText(),
      'modifiedbyuserid'        => new sfWidgetFormInputText(),
      'created_at'              => new sfWidgetFormDateTime(),
      'updated_at'              => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                      => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'title'                   => new sfValidatorString(),
      'citation'                => new sfValidatorString(),
      'abstract'                => new sfValidatorString(),
      'entityid'                => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Entity'))),
      'remarks'                 => new sfValidatorString(array('required' => false)),
      'publicationdate'         => new sfValidatorDate(array('required' => false)),
      'researchpaper'           => new sfValidatorString(array('required' => false)),
      'researchpaperfilename'   => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'researchpaperfiletype'   => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'researchpaperfilesize'   => new sfValidatorInteger(),
      'researchpaperurl'        => new sfValidatorString(array('required' => false)),
      'researchstatustyperefid' => new sfValidatorInteger(),
      'approvalstatustyperefid' => new sfValidatorInteger(),
      'approvalauthorityid'     => new sfValidatorInteger(array('required' => false)),
      'createbyuserid'          => new sfValidatorInteger(),
      'modifiedbyuserid'        => new sfValidatorInteger(),
      'created_at'              => new sfValidatorDateTime(),
      'updated_at'              => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('research[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Research';
  }

}
